package com.sl.static_proxy;

/**
 * author： suliang
 * 2023/1/4 15:05
 * describe : 静态代理类：实现代理接口，对原有功能进行增强
 */
public class ProxySubject implements Subject{
    //定义被代理类
    private Subject subject ;
    // 构造传入被代理类
    public ProxySubject(Subject subject){
        this.subject = subject ;
    }

    @Override
    public void say(String word) {
        System.out.println("ProxySubject start to say");
        subject.say(word);
        System.out.println("ProxySubject end to say");
    }

    @Override
    public void sayGoodBye() {
        System.out.println("ProxySubject start to say GoodBye");
        subject.sayGoodBye();
        System.out.println("ProxySubject start to say GoodBye");
    }
}
